<?php

class Form_Exhibition extends Zend_Form
{

    public function init()
    {
        $id = new Zend_Form_Element_Hidden("id");
        //$id->setLabel("Id: ");
        $id->setRequired(true);
        $id->setValue(0);
        $idValidator = new Zend_Validate_Int();
        $id->addValidator($idValidator);
        $this->addElement($id, "id");
        
        
        $title = new Zend_Form_Element_Text("title");
        $title->setLabel("Title: ");
        //$intValidator = new Zend_Validate_Int();
        $this->addElement($title, "title");
        
        
        $summary = new Zend_Form_Element_Textarea("summary");
        $summary->setLabel("Summary: ");
        //$summary->setAttrib("class", "ckeditor");
        //$intValidator = new Zend_Validate_Int();
        $this->addElement($summary, "summary");
        
        
        $start_time = new Zend_Form_Element_Text("start_time");
        $start_time->setLabel("Start Time: ");
        $start_time->setValue(date("Y-m-d"));
        $startTimeValidator = new Zend_Validate_Date();
        $start_time->addValidator($startTimeValidator);
        $this->addElement($start_time, "start_time");
        
        
        $end_time = new Zend_Form_Element_Text("end_time");
        $end_time->setLabel("End Time: ");
        $end_time->setValue(date("Y-m-d"));
        $endTimeValidator = new Zend_Validate_Date();
        $end_time->addValidator($endTimeValidator);
        $this->addElement($end_time, "end_time");
        
        //Exhibition cover here
//        $cover = new Zend_Form_Element_File("cover");
//        $cover->setLabel("Cover: ")->setRequired(true)
//        	->setDestination(APPLICATION_PATH . "/../public/images/exhibition_cover/");
//
//        $coverFilter = new Zend_Filter_File_Rename(md5(microtime()) . ".jpg");
//        
//        $cover->addFilter($coverFilter);
//        	
//        $coverValidator = new Zend_Validate_File_Extension("jpg");
//        $cover->addValidator($coverValidator);
//        $this->addElement($cover, "cover");
        
        //Exhibition cover on Home page
        $homePageCover = new Zend_Form_Element_File("homepageCover");
        $homePageCover->setLabel("Homepage Cover: ")->setRequired(true)
        	->setDestination(APPLICATION_PATH . "/../public/images/exhibition_homepage_cover/");

        $homePageCoverFilter = new Zend_Filter_File_Rename(md5(microtime()) . ".jpg");
        
        $homePageCover->addFilter($homePageCoverFilter);
        	
        $homePageCoverValidator = new Zend_Validate_File_Extension("jpg");
        $homePageCover->addValidator($homePageCoverValidator);
        $this->addElement($homePageCover, "homepage_cover");
        
        //artworks here
        $artworks = new Zend_Form_Element_Hidden("artworks");
        
        $artworks->setLabel("Artworks: ");
        //$intValidator = new Zend_Validate_Int();
        $this->addElement($artworks, "artworks");
        
        
        
        //submit here
        $submit = new Zend_Form_Element_Submit("submit");
        $this->addElement($submit, "submit");
    }


}

